/**
 * 
 */
package org.cuatrovientos.erp.business;

import java.util.List;

import org.apache.log4j.Logger;
import org.cuatrovientos.erp.dao.PayrollDAOInterface;
import org.cuatrovientos.erp.model.Payroll;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author eneko_lana
 * This class implements PayrollBOInterface
 */
public class PayrollBO implements PayrollBOInterface{
	// Get log4j logger
		private static final Logger logger = Logger.getLogger(PayrollBO.class);
		
		@Autowired
	    private PayrollDAOInterface PayrollDAO;
		
	/**
	 * @param int id
	 * @return Payroll Payroll
	 * This method returns a Payroll selected by it's id
	 */
	@Override
	public Payroll selectById(int id) {
		logger.info("selectById: " + id);
		return PayrollDAO.selectById(id);
	}
	
	/**
	 * @return All the countries we have in the database
	 */
	@Override
	public List<Payroll> selectAll() {
		logger.info("selectAll: ");
		return PayrollDAO.selectAll();
	}
	
	/**
	 * @return The number of countries we have in the database
	 */
	@Override
	public List<Payroll> search(String description) {
		logger.info("search : " + description);
		return PayrollDAO.search(description);
	}
	
	/**
	 * @param int id
	 * This method deletes the Payroll selected by id
	 */
	@Override
	public void deleteById(int id) {
		logger.info("delete by: " + id + " id");
		PayrollDAO.deleteById(id);
	}
	
	/**
	 * @param Payroll Payroll
	 * This method insert a Payroll in the database passed by parameter
	 */
	@Override
	public void insert(Payroll Payroll) {
		logger.info("insert: " + Payroll);
		PayrollDAO.insert(Payroll);
	}
	
	/**
	 * @param Payroll Payroll
	 * This method updates a Payroll passed by parameter
	 */
	@Override
	public void update(Payroll Payroll) {
		logger.info("update: " + Payroll);
		PayrollDAO.update(Payroll);
	}
	
	/**
	 * @param Payroll role
	 * This method deletes a Payroll passed by parameter
	 */
	@Override
	public void delete(Payroll Payroll) {
		logger.info("delete: " + Payroll);
		PayrollDAO.delete(Payroll);
	}

}
